package org.grow;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.swing.*;
import java.awt.*;

public class MainFrame extends JFrame {
    private AButton aButton;
    private BButton bButton;

    public AButton getaButton() {
        return aButton;
    }

    public void setaButton(AButton aButton) {
        this.aButton = aButton;
    }

    public BButton getbButton() {
        return bButton;
    }

    public void setbButton(BButton bButton) {
        this.bButton = bButton;
    }

    public void  postConstruct() {


        this.setTitle("rose");
        this.setSize(600,400);
        this.setLayout( new FlowLayout());

        this.add(aButton);
        this.add(bButton);


        this.setVisible(true);
    }

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext("./spring.xml");
        JButton aButton = (JButton) context.getBean("aButton");
        System.out.println(aButton.getText());
    }
}
